package com.example.parttimejob.controller;

import com.example.parttimejob.pojo.entity.Merchants;
import com.example.parttimejob.pojo.entity.PartTimeJobs;
import com.example.parttimejob.pojo.entity.User;
import com.example.parttimejob.service.AdminService;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/Admin")
public class AdminController {

    @Autowired
    private AdminService adminService;

    //查询所有用户
    @GetMapping("/User")
    public List<User> User()
    {
        return adminService.User();
    }

    //查询所有商家
    @GetMapping("/Store")
    public List<Merchants> Store()
    {
        return adminService.Store();
    }


    //根据用户名查询
    @GetMapping("/SearchUser/{username}")
    public List<User> SearchUser(@PathVariable String username)
    {
        return adminService.SearchUser(username);
    }
    //根据商家用户名查询商家
    @GetMapping("/SearchStore/{username}")
    public List<Merchants> SearchStore(@PathVariable String username)
    {
        return adminService.SearchStore(username);
    }


    //根据用户名查询需要审核的用户
    @GetMapping("/SearchCheckUser/{username}")
    public List<User> SearchCheckUser(@PathVariable String username)
    {
        return adminService.SearchCheckUser(username);
    }

    //查询所有需要审核的用户
    @GetMapping("/GetCheckUserInfo")
    public List<User> GetCheckUserInfo()
    {
       return adminService.GetCheckUserInfo();
    }



    //审核用户实名信息
    @PutMapping("/CheckUserInfo/{id}/{status}")
    public void  CheckUserInfo(@PathVariable Integer id,@PathVariable String status)
    {
        adminService.CheckUserInfo(id,status);
    }





    //查询所有需要审核的商家
    @GetMapping("/GetCheckStoreInfo")
    public List<Merchants> GetCheckStoreInfo()
    {
        return adminService.GetCheckStoreInfo();
    }

    //审核商家实名信息
    @PutMapping("/CheckStoreInfo/{id}/{status}")
    public void  CheckStoreInfo(@PathVariable Integer id,@PathVariable String status)
    {
        adminService.CheckStoreInfo(id,status);
    }

    //根据商铺名查询需要审核的用户
    @GetMapping("/SearchCheckStore/{username}")
    public List<Merchants> SearchCheckStore(@PathVariable String username)
    {
        return adminService.SearchCheckStore(username);
    }


    //查询所有需要审核的发布兼职信息
    @GetMapping("/GetCheckJobInfo")
    public List<PartTimeJobs> GetCheckJobInfo()
    {
        return adminService.GetCheckJobInfo();
    }

    //审核发布兼职的信息
    @PutMapping("/CheckJobInfo/{id}/{status}")
    public void  CheckJobInfo(@PathVariable Integer id,@PathVariable String status)
    {
        adminService.CheckJobInfo(id,status);
    }

    //根据标题查询需要审核的兼职活动
    @GetMapping("/SearchCheckJob/{username}")
    public List<PartTimeJobs> SearchCheckJob(@PathVariable String username)
    {
        return adminService.SearchCheckJob(username);
    }



    //封禁用用户账号
    @PutMapping("/BanUser/{id}")
    public String BanUser(@PathVariable Integer id){
    return adminService.BanUser(id);
    }


    //封禁商家账号
    @PutMapping("/BanStore/{id}")
    public String BanStore(@PathVariable Integer id){
        return adminService.BanStore(id);
    }
}
